home *** CD-ROM | disk | FTP | other *** search
/ Wonky Flux Batch 2019 02 / Wonky_Flux_Batch_2019-02.zip / Wonky Flux Batch 2019-02 / 075 - Clash of Arms.dsk / NEW.ARMY2.S < prev    next >
Text File  |  2019-02-17  |  11KB  |  342 lines

  1.           public viewmap
  2.  
  3.           on nocar goto link.term
  4.           gosub home
  5.           use "a:scroll.dn"
  6.           ch$=pc$
  7.           open #1,"h:war.map1":open #2,"h:war.map2"
  8.           gosub scanmap
  9.           nc=kc
  10.           close #1:open #1,"H:COORDS"
  11.           position #1,8,0:input #1 ky,ky
  12.           if ky<24 ma=0:mp=0:bo=24:yy=2:yo=2:tp=1:else mp=1:bo=47:yy=25:yo=25:ma=1:tp=24
  13.           close
  14.           open #1,"h:war.map1":open #2,"h:war.map2"
  15.           xx=2:xo=2:so=2:kc=0:te=1
  16.           gosub pmap
  17.           sy=2:nn=ab
  18.           na=0
  19.           y=yy:gosub getline1
  20.  
  21. placearmy
  22.           x=xx:y=sy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
  23.           gosub readcoords
  24.  
  25.           y=yy:gosub getline1
  26.           if yy<tp gosub scr1:else if yy>(tp+22) gosub scr2
  27.           sy=(yy-tp)+1:y=sy
  28.  
  29.           x=xx:y=yy:gosub getline1:y=sy:gosub screen
  30.           gosub invon:print mid$(l1$,xx,1);:gosub invoff
  31.           x=xx:y=yy:gosub armystrength
  32.           x=1:y=24:gosub screen:print "Armies: ";ar;" ";
  33.           x=18:y=24:gosub screen:print"Army "na+1"("nn"): < > Change City, (1-9) Place Army, (ESC) abort";
  34.           gosub getkey
  35.           if (ka$=">") or (ka$=".") ka=1:else ka=0
  36.           if (ka$="<") or (ka$=",") kb=1:else kb=0
  37.           if ((ka=1) and (kc<nc)) kc=kc+1:goto placearmy
  38.           if ((kb=1) and (kc>0)) kc=kc-1:goto placearmy
  39.           if ka$=chr$(27) gosub home:link "a:war.start","fromnew"
  40.           if not(val(ka$)) goto placearmy
  41.           ka=val(ka$):if ka=0 goto placearmy
  42.           if ka+ar>9  x=18:y=24:gosub screen:print "No more than nine armies per stack.  Press a key             ";:gosub getkey:goto placearmy
  43.           if na+ka>nn x=18:y=24:gosub screen:print "You don't have that many armies.     Press a key             ";:gosub getkey:goto placearmy
  44.           gosub newarmies
  45.           goto placearmy
  46.  
  47. viewmap
  48.           use "a:scroll.dn"
  49.           on nocar goto link.term
  50.           open #1,"h:war.map1":open #2,"h:war.map2"
  51.           gosub home:bo=24
  52.           tp=1
  53.           sy=1
  54.           poke 34,0
  55.           xx=2:yy=2:xo=2:yo=2:so=2:sy=2:te=0
  56.           gosub printmap
  57.           ch$=pc$
  58.           nn=ab
  59.           x=xx:y=yy:gosub getline1:y=sy:gosub screen
  60.           gosub invon:print mid$(l1$,xx,1);:gosub invoff
  61.           y=24:x=40:gosub screen:print "Explore Map.  Press <cr> to exit.";
  62.           gosub mapmove
  63.           gosub home
  64.           link "a:war.start","maincommand"
  65.           
  66. scr1
  67.           kb=yy:kd=tp
  68.           for ka=1 to (tp-yy):yy=kd-ka:gosub scrd2:next
  69.           yy=kb
  70.           tp=yy
  71.           return
  72. scr2
  73.           kb=yy:kd=tp+22
  74.           for ka=1 to (yy-(tp+22)):yy=kd+ka:gosub scru2:next
  75.           yy=kb
  76.           tp=yy-22
  77.           return
  78.  
  79. NewArmies
  80.           ar=ar+ka
  81.           b$=chr$(ar+48)
  82.           position #2,80,yy-1,xx-1
  83.           print #2,b$    ;
  84.           x=xx:y=yy:gosub getline1:gosub armystrength
  85.           x=1:y=bo:gosub screen:print "Armies: ";ar;" ";
  86.           ab=ab-ka:na=na+ka:if na<nn return
  87.           x=xx:y=sy:gosub screen:gosub invoff:print mid$(l1$,xx,1);
  88.           gosub home
  89.           link "a:war.start","fromnew"
  90.  
  91. getkey
  92.           ka=key(0):if ka=0 goto getkey
  93.           ka$=chr$(ka)
  94.           if asc(ka$)>96 ka$=chr$(asc(ka$)-32)
  95.           poke 99,0:poke 100,0
  96.           return
  97.  
  98. scrolldown
  99.           if (an=1) and (info(0)) print #4,"3r";
  100.           if (info(0)) and (pt=1) y=23:x=1:gosub screen:print #4,"";
  101.           x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
  102.           if (info(0)) and (an=1) print #4,"M";
  103.           close
  104.           call -25088
  105.           open #1,"h:war.map1":open #2,"h:war.map2"
  106.           y=yy-1:gosub getline1
  107.           x=1:y=1:gosub screen
  108.           print l1$      ;
  109.           ys=ys+1
  110.           ke=ke+1
  111.           tp=tp-1
  112.           if (info(0)) and (an=1) print #4,"4r";
  113.           return
  114. scrollup
  115.           if (an=1) and (info(0)) print #4,"3r";
  116.           x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
  117.           if (info(0)) and (an=1) x=79:y=23:gosub screen:print #4,""
  118.           x=1:y=23:gosub screen:if (info(0)) and (pt=1) print #4,"";
  119.           poke 35,23
  120.           y=yy+1:gosub getline1
  121.           x=1:y=23:gosub screen:print #3
  122.           gosub screen
  123.           print l1$      ;
  124.           poke 35,24
  125.           tp=tp+1
  126.           ys=ys-1
  127.           ke=ke-1
  128.           if (info(0)) and (an=1) print #4,"4r";
  129.           return
  130.  
  131. map2
  132.           if (ka$="K") and (xx<70) xx=xx+10:gosub erase:goto mapmv2
  133.           if (ka$="J") and (xx>10) xx=xx-10:gosub erase:goto mapmv2
  134.           if (ka$="I") and (sy>5) sy=sy-4:yy=yy-4:gosub erase:goto mapmv2
  135.           if (ka$="M") and (sy<19) sy=sy+4:yy=yy+4:gosub erase:goto mapmv2
  136.           if (ka$="I") and (tp>5) gosub erase:yy=tp-4:gosub scr3:sy=(yy-tp)+1:so=sy:xo=xx:yo=yy:goto mapmv2
  137.           if (ka$="M") and (tp<20) gosub erase:yy=tp+26:gosub scr4:sy=(yy-tp)+1:so=sy:xo=xx:yo=yy:goto mapmv2
  138.  
  139. mapmove
  140.           gosub getkey
  141.           if instr(ka$,"IJKM") goto map2
  142.           if instr(ka$,"147QAZ") ml=1:else ml=0
  143.           if instr(ka$,"369CDE") mr=1:else mr=0
  144.           if (ml) and (xx<>1) xx=xx-1:gosub erase
  145.           if (mr) and (xx<79) xx=xx+1:gosub erase
  146.           if instr(ka$,"QE79") ka$="8":else if instr(ka$,"ZC13") ka$="2"
  147.           if ((ka$="8") or (ka$='W')) and (sy<=2) and (yy>2) gosub erase:yy=yy-1:gosub scrolldown:xo=xx:yo=yy:so=sy:goto mapmv2
  148.           if ((ka$="2") or (ka$='X')) and (sy>=22) and (yy<45) gosub erase:yy=yy+1:gosub scrollup:xo=xx:yo=yy:so=sy:goto mapmv2
  149.           if ((ka$="8") or (ka$='W')) and (sy>2) yy=yy-1:sy=sy-1:gosub erase:goto mapmv2
  150.           if ((ka$="2") or (ka$='X')) and (sy<22) yy=yy+1:sy=sy+1:gosub erase:goto mapmv2
  151.           if ((ka$="8") or (ka$='W')) and (yy=2) goto mapmove
  152.           if ((ka$="2") or (ka$='X')) and (yy=45) goto mapmove
  153.  
  154. mapmv2
  155.           if ka$=chr$(27) return
  156.           if ka$=chr$(13) return
  157.           if instr(ka$," YN5") return
  158.           y=yy:gosub getline1
  159.           x=xx:y=sy:gosub screen:gosub invon:print mid$(l1$,xx,1);chr$(8);:gosub invoff
  160.           if ok ok=0:return
  161.           if instr(mid$(l1$,xx,1),"ABCDEF") x=9:y=24:gosub screen:gosub armystrength:print ar;" ";:else if ar<>0 x=9:y=24:gosub screen:print "0";:ar=0
  162.           if mid$(l1$,xx,1)<>tr$ gosub getterrain:x=24:y=24:gosub screen:print ms$;
  163.           x=xx:y=sy:gosub screen
  164.           goto mapmove
  165.  
  166. getterrain
  167.           a$=mid$(l1$,xx,1):if instr(a$,"ABCDEF") am=1:else am=0
  168.           y=yy:gosub getline2:b$=mid$(l2$,xx,1)
  169.           if a$="#" ms$="Impassable"
  170.           if a$=" " ms$="Land      "
  171.           if a$=":" ms$="Water     "
  172.           if a$="+" ms$="Empty Boat"
  173.           if a$="=" ms$="Deep Water"
  174.           if a$="*" ms$="City      "
  175.           if (am) and (asc(a$)>96) and (asc(b$)<65) ms$="Army      "
  176.           if (asc(a$)>96) and (am) and (asc(b$)>64) ms$="Army/Boat "
  177.           if (asc(a$)>64) and (asc(a$)<91) ms$="Army/City "
  178.           tr$=a$
  179.           return
  180.  
  181. armystrength
  182.           y=yy:gosub getline2
  183.           a$=mid$(l2$,xx,1)
  184.           if instr(a$,"0123456789") ar=val(a$):return
  185.           if instr(a$,"ABCDEFGHI") ar=asc(a$)-64:return
  186.           ar=0:return 
  187.  
  188.                          ; Scan the map for character CH$ and records coordinates in H:COORDS
  189.                          ;
  190.  
  191. ScanMap
  192.           x=40:y=bo:gosub screen
  193.           print \"Wait..scanning map...                   ";
  194.           kill "H:COORDS":create "H:COORDS"
  195.           kc=0:kb=0:if (asc(ch$)>96) and (asc(ch$)<123) kb=1:kb$=chr$(asc(ch$)-32)
  196.           for y = 2 to 45
  197.           gosub getline1:gosub getline2
  198.           ka=instr(ch$,l1$)
  199.           if not ka goto PastCheck
  200.  
  201.           for x = ka to 79
  202.           ka$=mid$(l1$,x,1)
  203.           if kb and (ka$=kb$) then gosub FoundMatch
  204.           next
  205. PastCheck
  206.           next:return
  207.  
  208. FoundMatch
  209.           close #1:open #1,"H:COORDS"
  210.           position #1,8,kc:print #1 x,y
  211.           position #1,8,kc+1:print #1 0,0
  212.           close #1:open #1,"H:WAR.MAP1"
  213.           kc=kc+1
  214.           return
  215.  
  216.                          ;
  217.                          ; Read coordinates from "H:COORDS" and calls Move routine
  218.                          ; Make sure KC=0 before calling, and don't use KC in move routine
  219.                          ;
  220.  
  221. ReadCoords
  222.           close #1:open #1,"H:COORDS"
  223.           position #1,8,kc:input #1 kx,ky
  224.           close #1:open #1,"H:WAR.MAP1"
  225.           if (kx=0) and (ky=0) kc=kc-1:return
  226.           xx=kx:yy=ky
  227.           return
  228.  
  229. erase
  230.           y=yo:gosub getline1
  231.           a$=mid$(l1$,xo,1)
  232.           x=xo:y=so:gosub screen
  233.           print a$       ;
  234.           xo=xx:yo=yy:so=sy
  235.           return
  236.  
  237. pmap
  238.           gosub home
  239.           if ma=0 fn=1:else fn=24 
  240.           for y=fn to fn+22
  241.           gosub getline1
  242.           print l1$
  243.           next
  244.           goto pmap2
  245. printmap
  246.           gosub home
  247.           for y=1 to 23
  248.           gosub getline1
  249.           print l1$
  250.           next
  251. pmap2
  252.           x=xx:y=yy:gosub getline1:gosub armystrength
  253.           x=1:y=24:gosub screen:print "Armies: ";ar;" ";
  254.           if te<>1 x=15:gosub screen:print "Terrain: ";ms$;
  255.           return
  256.  
  257. Screen
  258.           print #3 chr$(30);chr$(31+x);chr$(31+y);
  259.           if (pt) print #4 chr$(30);chr$(31+x);chr$(31+y);
  260.           if AN print #4 chr$(27); "["y";"x"f";
  261.           return
  262.  
  263. InvOn
  264.           print #3 chr$(15);
  265.           if (pt) print #4 chr$(15);
  266.           if an print #4 chr$(27);"[1m";
  267.           return
  268.  
  269. InvOff
  270.           print #3 chr$(14);
  271.           if (pt) print #4 chr$(14);
  272.           if an print #4 chr$(27);"[0m";
  273.           return
  274.  
  275. Home
  276.           print #3 chr$(12);
  277.           if (pt) print #4 chr$(12);
  278.           if an print #4 chr$(27);"[H";chr$(27);"[J";
  279.           return
  280.  
  281. rndm
  282.           zl$=rnd$
  283.           zl=((random(10000)+100)/100):if zl>100 then zl=zl-1
  284.           return
  285.  
  286. getline1
  287.           position #1,80,y-1
  288.           input #1,l1$
  289.           return
  290. getline2
  291.           position #2,80,y-1
  292.           input #2,l2$
  293.           return
  294.  
  295. scrd2
  296.           if (an=1) and (info(0)) print #4,"3r";
  297.           if (info(0)) and (pt=1) y=23:x=1:gosub screen:print #4,"";
  298.           x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
  299.           if (info(0)) and (an=1) print #4,"M";
  300.           close
  301.           call -25088
  302.           open #1,"h:war.map1":open #2,"h:war.map2"
  303.           y=yy:gosub getline1
  304.           x=1:y=1:gosub screen
  305.           print l1$      ;
  306.           ys=ys+1
  307.           ke=ke+1
  308.           tp=tp-1
  309.           if (info(0)) and (an=1) print #4,"4r";
  310.           return
  311. scru2
  312.           if (an=1) and (info(0)) print #4,"3r";
  313.           x=1:y=1:gosub screen:if (info(0)) and (pt=1) print #4,"";
  314.           if (info(0)) and (an=1) x=79:y=23:gosub screen:print #4,""
  315.           x=1:y=23:gosub screen:if (info(0)) and (pt=1) print #4,"";
  316.           poke 35,23
  317.           y=yy:gosub getline1
  318.           x=1:y=23:gosub screen:print #3
  319.           gosub screen
  320.           print l1$      ;
  321.           poke 35,24
  322.           tp=tp+1
  323.           ys=ys-1
  324.           ke=ke-1
  325.           if (info(0)) and (an=1) print #4,"4r";
  326.           return
  327.  
  328. scr3
  329.           kb=yy:kd=tp
  330.           for ka=1 to (tp-yy):yy=(kd-ka)+1:gosub scrolldown:next:yy=yy-1
  331.           if yy>=2:gosub scrolldown
  332.           yy=kb:tp=yy-1:return
  333. scr4
  334.           kb=yy:kd=tp+22
  335.           if kd=yy gosub scrollup:tp=yy-21:return
  336.           for ka=1 to (yy-kd):yy=(kd+ka)-1:gosub scrollup:next:yy=yy+1
  337.           if yy<=45 gosub scrollup
  338.           yy=kb:tp=yy-21:return
  339.  
  340. link.term
  341.           link "a:war.start","termgame"
  342.